package org.yty.travelagencyredis.service.impl;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.yty.travelagencyredis.Dao.GroupMessageDao;
import org.yty.travelagencyredis.model.DTO.HistoryGroupMessageQueryDTO;
import org.yty.travelagencyredis.model.Entity.GroupMessage;
import org.yty.travelagencyredis.service.GroupMessageService;

import java.util.List;

@Service
@RequiredArgsConstructor
public class GroupMessageServiceImpl implements GroupMessageService {
    private final GroupMessageDao groupMessageDao;

    @Override
    public void save(GroupMessage groupMessage) {
        this.groupMessageDao.insert(groupMessage);
    }

    @Override
    public List<GroupMessage> getHistoryMessages(HistoryGroupMessageQueryDTO historyGroupMessageQueryDTO) {
        return this.groupMessageDao.getHistoryMessages(historyGroupMessageQueryDTO);
    }

    @Override
    public List<GroupMessage> getMessages(Long chatGroupId) {
        return this.groupMessageDao.getMessages(chatGroupId);
    }
}
